package service

import (
	"bufio"
	"fmt"
	"io"
	"os/exec"
)

func Shell(name string, arg ...string)  {

	cmd := exec.Command( name, arg...)
	stdout, err := cmd.StdoutPipe()
	if err != nil {
		fmt.Println(err)
		return
	}
	cmd.Start()
	reader := bufio.NewReader(stdout)
	for {
		line, err2 := reader.ReadString('\n')
		if err2 != nil || io.EOF == err2 {
			break
		}
		fmt.Println("[info][command]：", line)
	}
	cmd.Wait()
	return
}
